<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/inc/taglibs.jsp"%>
<script type="text/javascript">
function processBack(response){
	alertMsg.correct(response.message);
	 $.pdialog.closeCurrent();
	 navTab.reload("${path }/admin/userRechargeStrategy", "");
}

$('#type').change(function(){ 
	$("#subId").empty();
	if($(this).val()==2){
		$("#subId").append("<option value='1' selected>按消费金额数值赠送</option>");
		$("#subId").append("<option value='2'>按消费金额比例赠送</option>");
	}else{
		$("#subId").append("<option value='1' selected>按金额数值赠送</option>");
		$("#subId").append("<option value='2'>按金额比例赠送</option>");
	}

});
</script>
<c:choose>
	<c:when test="${model.id==0 ||empty model.id}">
		<c:set var="action" value="${path }/admin/userRechargeStrategy/add.do"></c:set>
	</c:when>
	<c:otherwise>
		<c:set var="action" value="${path }/admin/userRechargeStrategy/update.do"></c:set>
	</c:otherwise>
</c:choose>
<div class="pageContent">
	<form method="post" action="${action }" class="pageForm required-validate" onsubmit="return validateCallback(this, processBack);">
		<input name="id" type="hidden" size="75" value="${model.id }"/>
		<input type="hidden" name="rel" value="${rel}"/>
		<div class="pageFormContent" layoutH="57" align="left">
		
		
			<p class="nowrap">
                    <label>类型：</label>
                    <select id="type" name="type" >
                    	<option value="1" ${model.type == 1 ? 'selected=selected' : ''}>送金额</option>
                    	<option value="2" ${model.type == 2 ? 'selected=selected' : ''}>送积分</option>
                    </select>
            </p>
			<p class="nowrap">
                    <label>策略：</label>
                    <select id="subId" name="subId" >
                    	<c:if test="${model.type == 1 || model.type == null}">
                        	<option value="1" ${model.subId == 1 ? 'selected=selected' : ''}>按金额数值赠送</option>
                    		<option value="2" ${model.subId == 2 ? 'selected=selected' : ''}>按金额比例赠送</option>
                    	</c:if>
                    	<c:if test="${model.type == 2 }">
                        	<option value="1" ${model.subId == 1 ? 'selected=selected' : ''}>按消费金额数值赠送</option>
                    		<option value="2" ${model.subId == 2 ? 'selected=selected' : ''}>按消费金额比例赠送</option>
                    	</c:if>
					</select>
            </p>
		
		
		
		
			<p class="nowrap">
				<label>本金值：</label>
				<input name="rechargeMoney" type="text"  value="${model.rechargeMoney }" class="required" />
			</p>
			<p class="nowrap">
				<label>赠送值：</label>
				<input name="giveMoney" type="text"  value="${model.giveMoney }" class="required" />
			</p>
			<p class="nowrap">
				<label>描述：</label>
				<input name="remark" type="text"  value="${model.remark }" class="required" />
			</p>
			<div class="unit">
				<label>开始时间：</label>
				<input type="text" name="startTime" value="<fmt:formatDate value='${model.startTime}' pattern='yyyy-MM-dd HH:mm:ss' />" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" readonly="true">
				<a class="inputDateButton" href="javascript:;">选择</a>
			</div>
			<p class="nowrap">
				<label>结束时间：</label>
				<input type="text" name="endTime" value="<fmt:formatDate value='${model.endTime}' pattern='yyyy-MM-dd HH:mm:ss' />" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" readonly="true">
				<a class="inputDateButton" href="javascript:;">选择</a>
			</p>
		</div>
		<div class="formBar">
			<ul>
			<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">返回</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>
